<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>7.await的应用</title>
</head>
<body>
<script>
     const  p1 = new Promise((resolve, reject) => {
       setTimeout(()=>{
         resolve("第一次请求成功");
       })
     });
     const  p2 = new Promise((resolve, reject) => {
       setTimeout(()=>{
         resolve("第二次请求成功");
       })
     });
     const  p3 = new Promise((resolve, reject) => {
       setTimeout(()=>{
         reject("第三次请求失败");
       })
     });

     try {
       (async () => {
           await p1;
           await p2;
           await p3
       })();
     } catch (e) {
       console.log(e)
     }

</script>

</body>
</html>